﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using Micronet.OpenWeb.Com.BLL;
using Micronet.OpenWeb.Com.Controls;
using Micronet.OpenWeb.Entity;
using Micronet.OpenWeb.Utils;

namespace Micronet.OpenWeb.OpenWeb.Admin.Views.Shared.Blog
{
    public partial class BlogsAdmin : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void AllowSendPingbackTrackbackCbb_CheckedChanged(object sender, EventArgs e)
        {
            var SendPingPack = (OwCheckBox)sender;

            var obj = OwBlogsBLL.OwGetEntity(SendPingPack.Text.Trim().OwToInt64TryParse());
            obj.AllowSendPingbackTrackback = SendPingPack.Checked.ToString().OwToBoolean();
            if (OwBlogsBLL.OwSave(obj) > 0)
            {
                BlogsAdmingv.Rebind();
            }
        }

        protected void AllowReceivePingbackTrackbackCbb_CheckedChanged(object sender, EventArgs e)
        {
            var ReceivePingPack = (OwCheckBox)sender;

            var obj = OwBlogsBLL.OwGetEntity(ReceivePingPack.Text.Trim().OwToInt64TryParse());
            obj.AllowReceivePingbackTrackback = ReceivePingPack.Checked.ToString().OwToBoolean();
            if (OwBlogsBLL.OwSave(obj) > 0)
            {
                BlogsAdmingv.Rebind();
            }
        }

        protected void IsDeletedChk_CheckedChanged(object sender, EventArgs e)
        {
            var IsDeleted = (OwCheckBox)sender;

            var obj = OwBlogsBLL.OwGetEntity(IsDeleted.Text.Trim().OwToInt64TryParse());
            obj.IsDeleted = IsDeleted.Checked.ToString().OwToBoolean();
            if (OwBlogsBLL.OwSave(obj) > 0)
            {
                BlogsAdmingv.Rebind();
            }
        }
    }
}